﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIIS.Infrastructure.Model.System.Authority;
using EIIS.Infrastructure.Service;
using EIIS.Infrastructure.Service.System.Authority;
using EIIS.Infrastructure.Repositories.System.Authority;

namespace EIIS.Infrastructure.Service.Implement
{
    public class RoleManager:GenericManagerBase<Role>,IRoleManager
    {
        public bool IsExistWithName(string strName, string strId, string strWhere)
        {
            return ((IRoleRepository)(this.CurrentRepository)).IsFieldExist("Name", strName, strId, strWhere);
        }

        public IList<Role> LoadAllWithPage(out long total, int page, int rows, string order, string sort)
        {
            return ((IRoleRepository)(this.CurrentRepository)).LoadAllWithPage(out total, page, rows, order, sort).ToList();
        }

        public IList<Role> GetByIdWithMenuAndPermissions(string strId)
        {
            return ((IRoleRepository)(this.CurrentRepository)).GetByIdWithMenuAndPermissions(strId).ToList();
        }

        public void SaveRole(Role role, string inheritedRoleId)
        {
            ((IRoleRepository)(this.CurrentRepository)).SaveRole(role, inheritedRoleId);
        }
    }
}
